package com.zhao.fishingguideserver.controller;

import com.zhao.fishingguideserver.POJO.OperationLog;
import com.zhao.fishingguideserver.POJO.Result;
import com.zhao.fishingguideserver.service.OperationLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 操作日志控制器
 */
@RestController
@RequestMapping("/admin/system/log")
public class AdminOperationLogController {
    
    @Autowired
    private OperationLogService operationLogService;
    
    /**
     * 查询操作日志列表
     */
    @GetMapping("/list")
    public Result<List<OperationLog>> getLogList(@RequestParam(required = false) String adminName,
                                                  @RequestParam(required = false) String operationType,
                                                  @RequestParam(required = false) String operationModule) {
        try {
            List<OperationLog> logs = operationLogService.getLogList(adminName, operationType, operationModule);
            return Result.success(logs);
        } catch (Exception e) {
            return Result.error("获取操作日志失败：" + e.getMessage());
        }
    }
}

